<!DOCTYPE html>
<script src="../../../resources/run-after-layout-and-paint.js"></script>
<script>
onload = () => {
  runAfterLayoutAndPaint(() => {
    target.textContent = "New text"
  }, true);
}
</script>
<div style="background: linear-gradient(blue, green);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent">
  <div>
    <div>
      <div id="target">Old text</div>
    </div>
  </div>
</div>
